﻿<visi:VisiPage x:Class="VNet.VisiSuite.VisiBoard.Views.DowntimeView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:visi="clr-namespace:VNet.VisiSuite.VisiBoard.Controls"
        xmlns:vuc="clr-namespace:VNet.VisiSuite.Controls;assembly=VNet.VisiSuite.Controls"
        xmlns:ig="http://schemas.infragistics.com/xaml"
        xmlns:vm="clr-namespace:VNet.VisiSuite.VisiBoard.ViewModels" 
        xmlns:converter="clr-namespace:VNet.VisiSuite.Common.Converters;assembly=VNet.VisiSuite.Common"
        xmlns:c="clr-namespace:VNet.VisiSuite.VisiBoard.Controls"
        xmlns:helper="clr-namespace:VNet.VisiSuite.VisiBoard.Common.Helpers"
        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        DataContext="{DynamicResource DowntimeViewModel}"  mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="800" >
    <visi:VisiPage.Resources>
        <vm:DowntimeViewModel x:Key="DowntimeViewModel"/>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
        <converter:TicksConverter x:Key="ticksConverter" />
        <converter:BarMarkerConverter x:Key="BarMarkerConverter" />
        <converter:BarMarkerVisibleConverter x:Key="BarMarkerVisibleConverter" />
        <converter:InvertBooleanVisibilityConverter x:Key="InvertBooleanVisibilityConverter" />
        <converter:IntObjectStringConverter x:Key="IntObjectStringConverter"/>
        <converter:ColorStringToColorConverter x:Key="ColorStringToColorConverter"/>

    </visi:VisiPage.Resources>
    <vuc:BusyIndicator IsBusy="{Binding IsBusy}">
        <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="{StaticResource WhiteColor}" Focusable="False" Margin="10,0,10,10">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="42" />
            </Grid.RowDefinitions>


            <!--Header-->
            <c:Header2Control Grid.Row="0" TextBrush="{StaticResource LightDeepSkyBlueColor}"  Title="{Binding PageTitle}" Background="{Binding HeaderBrush, Mode=OneWay}" LeftMenuIcons="{Binding TopLeftButtonIcons}"/>

            <!--Body-->
            <Grid Grid.Row="1">

                <Grid.RowDefinitions>
                    <RowDefinition Height="30" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="12" />
                    <ColumnDefinition Width="5*" />
                    <ColumnDefinition Width="30" />
                    <ColumnDefinition Width="5*" />
                    <ColumnDefinition Width="12" />
                </Grid.ColumnDefinitions>

                <vuc:DowntimeGraphControl Title="{Binding BarGraphTitle}" TitleFontColor="{StaticResource LightDeepSkyBlueColor}" GraphData="{Binding BarGraphData}"  Grid.Row="0" Grid.RowSpan="2" Grid.Column="1" />
                
                <TextBlock Text="Downtime Trend (minutes)" FontSize="14pt" Foreground="{StaticResource LightDeepSkyBlueColor}" Grid.Row="0" Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <ig:XamDataChart Grid.Column="3" Grid.Row="1"
                         Padding="0" Visibility="Visible"
                         DataContext="{StaticResource DowntimeViewModel}"
                        >
                    <ig:XamDataChart.Axes>
                        <ig:NumericYAxis x:Name="Y_Axis" FontSize="14"  MinimumValue="0" Interval="{Binding Path=LineInterval}" MaximumValue="{Binding Path=MaximumLineValue}">
                            <ig:NumericYAxis.LabelSettings>
                                <ig:AxisLabelSettings FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Right" Padding="0 0 8 0"></ig:AxisLabelSettings>
                            </ig:NumericYAxis.LabelSettings>
                        </ig:NumericYAxis>
                        <ig:CategoryXAxis x:Name="X_Axis" ItemsSource="{Binding Path=DowntimeLineData}" Interval="1" Label="{}{Time}" >
                            <ig:CategoryXAxis.LabelSettings>
                                <ig:AxisLabelSettings FontSize="14" />
                            </ig:CategoryXAxis.LabelSettings>
                        </ig:CategoryXAxis>
                    </ig:XamDataChart.Axes>
                    <ig:XamDataChart.Series>
                        <ig:LineSeries ItemsSource="{Binding Path=DowntimeLineData}"  ValueMemberPath="Duration"
                                     XAxis="{Binding ElementName=X_Axis}"
                                     YAxis="{Binding ElementName=Y_Axis}" Brush="Red"
                                 >
                        </ig:LineSeries>

                    </ig:XamDataChart.Series>
                </ig:XamDataChart>

            </Grid>
             
            <!--Footer-->
            <ContentControl Grid.Row="2" Template="{StaticResource FooterTemplate}" />
        </Grid>
    </vuc:BusyIndicator>
</visi:VisiPage>
